<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@taglib uri="/WEB-INF/tld/pageutil.tld" prefix="pu"%>
<%@taglib uri="/WEB-INF/tld/pageable.tld" prefix="pageable"%>
<%@taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt-rt"%>
<%@taglib uri="http://java.sun.com/jstl/core_rt" prefix="c-rt"%>
<%@	page import="com.yaodian100.core.common.utils.ServerValue"%>
<c-rt:set var="midContextPath" value='<%=ServerValue.getMidContextPath()%>'/>
<c-rt:set var="tp" value="${pu:pageableTag('tpp', 10, 10)}"/>
<c-rt:set var="hql">
from Bonus where memberId = ? 
</c-rt:set>

<c-rt:set var="params" value="${pu:addToList('paras', param.memberId)}"/>
<c-rt:if test="${not empty bonusTypeParam}">
	<c-rt:set var="hql">${hql} and trxType = ?</c-rt:set>
	<c-rt:set var="params" value="${pu:addToList('paras', bonusTypeParam)}"/>
</c-rt:if>
<c-rt:set var="hql">${hql} order by startDate DESC, id DESC</c-rt:set>
<c-rt:set var="bonus" value="${pu:queryByHql(hql, params, tp)}"/>
<s:actionerror />
<s:actionmessage />
<s:fielderror />
<script language="javascript">
$().ready( function() {
	$('#sendData').click(function(){
		doAR('${midContextPath}/member/searchBonus.do?AJAX=true&refreshZone=tabs-7', 'tabs-7', 'bonusForm');
	});
});
</script>
<div class="data-form">
<s:form name="bonusForm" method="post">
	<b>类型</b>
	<s:select label="积分类别" name="bonusTypeParam" headerKey="" headerValue="全部"
		list="bonusTypeMenu.options" listKey="key" listValue="value.name" />
	<input type="hidden" name="memberId" value="${memberId}"/>
	<input type="button" id="sendData" value="搜寻"/>
</s:form>
</div>
<table class="tb-1" width="100%">
	<thead>
		<tr>
			<th>积分数</th>
			<th>己使用</th>
			<th>已退回</th>
			<th>馀额</th>
			<th>效期</th>
			<th>种类</th>
			<th>说明</th>
		</tr>
	</thead>
	<tbody>
		<c-rt:forEach items="${bonus}" var="bonus" varStatus="rows_index">
			<tr class="${rows_index.count % 2 == 0 ? 'bg-yl' : ''}">
				<td>${bonus.trxAmount}</td>
				<td>${bonus.useBonus}</td>
				<td>${bonus.refoundBonus}</td>
				<td>${bonus.trxAmount - bonus.useBonus + bonus.refoundBonus}</td>
				<td>
					<fmt-rt:formatDate value="${bonus.startDate}" pattern="yyyy-MM-dd"/> ~ 
					<fmt-rt:formatDate value="${bonus.expireDate}" pattern="yyyy-MM-dd"/> 
				</td>
				<td>${bonusTypeMenu.options[bonus.trxType].name}</td>
				<td>
					${bonus.description}
					<c-rt:if test="${not empty bonus.orderId}">
					- 订单编号：${bonus.orderId}
					</c-rt:if>
				</td>
			</tr>
		</c-rt:forEach>
	</tbody>
</table>
<pageable:Pageable url="${midContextPath}/member/searchBonus.do" parameter="AJAX=true&refreshZone=tabs-7" escapeparams="AJAX,refreshZone" formname="NewBonusForm" key="tpp"></pageable:Pageable>
